package backend.majiong.yaku.yaku;

import backend.MainGame;
import backend.majiong.Pai;
import backend.majiong.Player;
import backend.majiong.yaku.AbstractYaku;
import backend.majiong.yaku.HandCombo;


public class YakuHai extends AbstractYaku {

    Integer yakuNum = 0;
    
    @Override
    public boolean checkYaku(Player player, HandCombo combo, MainGame mainGame) {
        yakuNum = 0;
        for (Pai pai : combo.getKeZi()) {
            if (pai.isSanYuan() || pai.equals(combo.getSelfWind())) {
                yakuNum++;
            }
        }
        for (Pai pai : combo.getGangZi()) {
            if (pai.isSanYuan()) {
                yakuNum++;
            }
        }
        if(yakuNum > 0) {
            return true;
        }
        return false;
    }

    @Override
    public String getYakuName() {
        return "役牌";
    }

    @Override
    public Integer getYakuNum(boolean isMenQing) {
        return yakuNum;
    }

}
